
_realname=kseexpr
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=4.0.4.0
pkgrel=1
pkgdesc="An embeddable expression evaluation engine (Krita fork)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://invent.kde.org/graphics/kseexpr"
license=("spdx:GPL-3.0-only")
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-cc"
  "${MINGW_PACKAGE_PREFIX}-extra-cmake-modules"
  "${MINGW_PACKAGE_PREFIX}-qt5-tools"
)
depends=(
  "${MINGW_PACKAGE_PREFIX}-qt5-base"
)
source=("https://download.kde.org/stable/kseexpr/${pkgver%.*}/${_realname}-${pkgver}.tar.gz")
sha256sums=('ea4f6a8e820e6cc12d2a1e6977e96ea5457f37729fe0bc4ee8cc62d4c26c36ae')

build() {
  [[ -d "build-${MSYSTEM}" ]] && rm -rf "build-${MSYSTEM}"
  mkdir -p "${srcdir}/build-${MSYSTEM}"
  cd "${srcdir}/build-${MSYSTEM}"

  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
  ${MINGW_PREFIX}/bin/cmake \
    -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
    -G "MSYS Makefiles" \
    -DCMAKE_BUILD_TYPE="Release" \
    -DBUILD_DEMOS="OFF" \
    -DBUILD_TESTS="OFF" \
    ../${_realname}-${pkgver}

  ${MINGW_PREFIX}/bin/cmake --build .
}

package() {
  cd "${srcdir}/build-${MSYSTEM}"

  DESTDIR=${pkgdir} ${MINGW_PREFIX}/bin/cmake.exe --install .

  install -vDm 644 ${srcdir}/${_realname}-${pkgver}/LICENSE.txt -t "${pkgdir}${MINGW_PREFIX}/share/licenses/$_realname/"
}